# class Manage:
#     def __new__(cls, *args, **kwargs):
#         """
#         构造函数用于 创建实例
#         通过父类 的构造函数来创建实例
#         """
#         instance = super().__new__(cls)
#         # print(instance, type(instance))
#         print(f"创建实例{id(instance)}")
#         return instance
#
#     def __init__(self):
#         print("初始化实例", id(self))
#         """
#         初始化方法 初始化self实例
#         """
#
#
# m1 = Manage()
# m2 = Manage()
# m3 = Manage()
# print(id(None))
# print(m1 is None, m2 is None, m3 is None)
# print(id(m1), id(m2), id(m3))


class Manage:
    instance = None

    def __new__(cls, *args, **kwargs):
        if not Manage.instance:
            Manage.instance = super().__new__(cls)
        return Manage.instance

# m1 = Manage()
#
# m2 = Manage()
#
# print(id(m1), id(m2), m1 is m2)


class AduioManage(Manage):
    pass


am1 = AduioManage()
am2 = AduioManage()

print(am1 is am2)


class EffectManage(Manage):
    pass

em1 = EffectManage()
em2 = EffectManage()
print(em1 is em2)

